feat: add daemon mode for persistent MCP connections#5
feat: add daemon mode for persistent MCP connections#5cs50victor wants to merge 2 commits intophilschmid:mainfrom
Conversation
f63f043 to
ac7835f
Compare
|
Interesting idea, but i didn't want to add a daemon as it adds a new command which the mode needs to understand and manage. Did you test your branch? What is the impact of it? |
|
@philschmid I tested this PR with a few MCPs I use alongside Claude Code, such as chrome-devtools-mcp. It fixes the issue of state not being preserved between tool calls, which is necessary for chaining tool calls in complicated browsing tasks - for example, opening a page, taking a screenshot, navigating to a URL, then clicking a link on the page. If you'd like me to refactor this PR or make any changes to the API, I'm open to doing so. |
|
Interesting MCP servers should be stateless by default. Is the chrome dev tool not stateless? If we want to add this we also need to update hte readme, skill and SI. Can you look at this as well? Once we have all of that i will test it too. |
|
i've also updated the pr description with commands to reproduce the error i was facing. |
|
hey @philschmid let me know if there are any changes to make so this goes in. |
|
Hey thank you for the PR. I did some experiments myself and added Daemon support in 0.3.0 full changes here: https://github.com/philschmid/mcp-cli/blob/main/CHANGELOG.md#030---2026-01-22 The Daemon is lazy meaning the first request creates a connection which is hold for 60s (configurable) and is reused for the next request. |
|
nice. that's a much more efficient design. |
adds a persistent connection daemon that keeps MCP server processes alive across CLI invocations, enabling stateful workflows without reconnection overhead.
mcp-cli daemon start|stop|status- manage daemon lifecycleMCP_DAEMON_SOCKET- Socket path (default: ~/.mcp-cli/daemon.sock)MCP_DAEMON_IDLE_MS- Idle timeout in ms (default: 300000)tested
bun run lintpassesbun run typecheckpassesbun run testpasses (120/122, 2 pre-existing failures)Before vs After
navigate_page→list_pagesabout:blank(new browser)Concrete example with chrome-devtools-mcp: